<?php
	//跨域被请求必须加,冒号后面代表请求的网站网址,*代表任何网站都可以跨域请求该php页面的数据
	header("Access-Control-Allow-Origin:*");
	include('include/config.php');
	$a = 'guangxikeji';
/*	$b = array('但是','撒');
	$sql = "CREATE TABLE $a (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, 
reg_date TIMESTAMP
)";
if ($conn->query($sql) === TRUE) {
    echo "Table MyGuests created successfully";
} else {
    echo "创建数据表错误: " . $conn->error;
}*/
/*
	$z = array('喆喆','阿阿');
	forEach($z as $k){
		$sql="ALTER TABLE guangxikeji ADD COLUMN $k VARCHAR(20) DEFAULT NULL";
		if ($conn->query($sql) === TRUE) {
			echo '插入成功';
		} else {
			echo "创建数据表错误: " . $conn->error;
		}
	}*/
	$z = array('喆喆','阿阿');
	$zz = array('aaa','nnnn');
	
	$fieldLists = implode(",", $z);// 字段不需要添加引号，转换即可
	$zzz = implode("','", $zz);// 字段不需要添加引号，转换即可
	$sql = "INSERT INTO $a ( $fieldLists )
VALUES ( '$zzz' )";
if ($conn->query($sql) === TRUE) {
    echo "新记录插入成功";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

	
/*	$sql="ALTER TABLE guangxikeji ADD COLUMN www VARCHAR(20) DEFAULT NULL";
	if ($conn->query($sql) === TRUE) {
		echo "Table MyGuests created successfully";
	} else {
	  echo "创建数据表错误: " . $conn->error;
	}*/
	









?>